<?php

	$value_sensor1 = exec('cat /sys/class/hwmon/hwmon0/device/temp1_input');
	$value_sensor2 = exec('cat /sys/class/hwmon/hwmon1/device/temp1_input');
	$value_sensor3 = exec('cat /sys/class/hwmon/hwmon2/device/temp1_input');
	$value_sensor4 = exec('cat /sys/class/hwmon/hwmon3/device/temp1_input');
	$value_sensor5 = exec('cat /sys/class/hwmon/hwmon3/device/temp1_input');
	$value_sensor6 = exec('tail -n 1 /var/www/scripts/log/Terra1');

	$choose1= $_POST["pot1"];
	$choose2= $_POST["pot2"];
	$choose3= $_POST["pot3"];
	$choose4= $_POST["pot4"];
	$choose5= $_POST["pot5"];
	$choose6= $_POST["pot6"];

	$plot_loc1="scripts/plotter/plotfiles/aussen_$choose1";
	$plot_loc2="scripts/plotter/plotfiles/kalt_$choose2";
	$plot_loc3="scripts/plotter/plotfiles/oben_$choose3";
	$plot_loc4="scripts/plotter/plotfiles/unten_$choose4";
	$plot_loc5="scripts/plotter/plotfiles/sonne_$choose5";
	$plot_loc6="scripts/plotter/plotfiles/Terra1_$choose6";

	$box_width=680;
	$box_height=420;


?>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
  <title> Terrarien Steuerung </title>
  <meta name="description" content="">
  <meta name="keywords" content="">
  <link rel="stylesheet" href="style.css" type="text/css">
</head>

<body>

<h3>Sensorwerte Terrarium 1:</h3>

<table border=3>
   <tr>
		<th> Au&szlig;en: </th> 
		<td> <?php echo "$value_sensor1[0]$value_sensor1[1].$value_sensor1[2] &deg;C" ?></td>
		
   </tr>
		
   <tr>
		<th> Kaltstelle: </th> 
		<td> <?php echo "$value_sensor2[0]$value_sensor2[1].$value_sensor2[2] &deg;C" ?></td>
   </tr>

	<tr>
		<th> Oben: </th> 
		<td> <?php echo "$value_sensor3[0]$value_sensor3[1].$value_sensor3[2] &deg;C" ?></td>
   </tr>

	<tr>
		<th> Unten: </th> 
		<td> <?php echo "$value_sensor4[0]$value_sensor4[1].$value_sensor4[2] &deg;C" ?></td>
   </tr>

	<tr>
		<th> Sonne: </th> 
		<td> <?php echo "$value_sensor5[0]$value_sensor5[1].$value_sensor5[2] &deg;C" ?></td>
   </tr>
	<tr>
		<th> Durchschnitt: </th> 
		<td> <?php echo "$value_sensor6[0]$value_sensor6[1].$value_sensor6[2] &deg;C" ?></td>
   </tr>
</table>


	


<h3>Visualisierung des Temperaturverlaufs:</h3>


<!--<li>scripts/plotter/plotfiles/aussen_lasth.png</li>!-->
<form action="datalog.php" method="post">
<table border=3>
  <tr>
	<h4>Au&szlig;en:</h4>
	<?php
 if ( $choose1 != "" )
 {
 	echo "<img id=\"plot\" src=\"$plot_loc1.png\" width=\"$box_width\" height=\"$box_height\">\n";
 }

?>	
  </tr>
  <tr>
    <td>
      <input type="radio" name="pot1" value="lasth">Stunde
    </td>

    <td>
      <input type="radio" name="pot1" value="lastd">Tag
    </td>

    <td>
      <input type="radio" name="pot1" value="lastw">Woche
    </td>
  </tr>
</table>
<input type="submit" name="case" value="Auswahl anzeigen">
</form>







<form action="datalog.php" method="post">
<table border=3>
  <tr>
	<h4>Kaltstelle:</h4>
	<?php
 if ( $choose2 != "" )
 {
 	echo "<img id=\"plot\" src=\"$plot_loc2.png\" width=\"$box_width\" height=\"$box_height\">\n";
 }

?>
  </tr>
  <tr>
    <td>
      <input type="radio" name="pot2" value="lasth">Stunde
    </td>

    <td>
      <input type="radio" name="pot2" value="lastd">Tag
    </td>

    <td>
      <input type="radio" name="pot2" value="lastw">Woche
    </td>
  </tr>
</table>
<input type="submit" name="case" value="Auswahl anzeigen">
</form>





<form action="datalog.php" method="post">
<table border=3>
  <tr>
	<h4>Oben:</h4>
	<?php
 if ( $choose3 != "" )
 {
 	echo "<img id=\"plot\" src=\"$plot_loc3.png\" width=\"$box_width\" height=\"$box_height\">\n";
 }

?>
  </tr>
  <tr>
    <td>
      <input type="radio" name="pot3" value="lasth">Stunde
    </td>

    <td>
      <input type="radio" name="pot3" value="lastd">Tag
    </td>

    <td>
      <input type="radio" name="pot3" value="lastw">Woche
    </td>
  </tr>
</table>
<input type="submit" name="case" value="Auswahl anzeigen">
</form>






<form action="datalog.php" method="post">
<table border=3>
  <tr>
	<h4>Unten:</h4>
	<?php
 if ( $choose4 != "" )
 {
 	echo "<img id=\"plot\" src=\"$plot_loc4.png\" width=\"$box_width\" height=\"$box_height\">\n";
 }

?>
  </tr>
  <tr>
    <td>
      <input type="radio" name="pot4" value="lasth">Stunde
    </td>

    <td>
      <input type="radio" name="pot4" value="lastd">Tag
    </td>

    <td>
      <input type="radio" name="pot4" value="lastw">Woche
    </td>
  </tr>
</table>
<input type="submit" name="case" value="Auswahl anzeigen">
</form>







<form action="datalog.php" method="post">
<table border=3>
  <tr>
	<h4>Sonne:</h4>
	<?php
 if ( $choose5 != "" )
 {
 	echo "<img id=\"plot\" src=\"$plot_loc5.png\" width=\"$box_width\" height=\"$box_height\">\n";
 }

?>
  </tr>
  <tr>
    <td>
      <input type="radio" name="pot5" value="lasth">Stunde
    </td>

    <td>
      <input type="radio" name="pot5" value="lastd">Tag
    </td>

    <td>
      <input type="radio" name="pot5" value="lastw">Woche
    </td>
  </tr>
</table>
<input type="submit" name="case" value="Auswahl anzeigen">
</form>





<form action="datalog.php" method="post">
<table border=3>
  <tr>
	<h4>Durchschnitt:</h4>
	<?php
 if ( $choose6 != "" )
 {
 	echo "<img id=\"plot\" src=\"$plot_loc6.png\" width=\"$box_width\" height=\"$box_height\">\n";
 }

?>
  </tr>
  <tr>
    <td>
      <input type="radio" name="pot6" value="lasth">Stunde
    </td>

    <td>
      <input type="radio" name="pot6" value="lastd">Tag
    </td>

    <td>
      <input type="radio" name="pot6" value="lastw">Woche
    </td>
  </tr>
</table>
<input type="submit" name="case" value="Auswahl anzeigen">
</form>



</body>
</html>
